<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // await右侧是promise对象
        // 必须配合async函数使用！
        // 非promise对象 返回其结果
        // promise成功，则返回其成功结果值
        // promise失败，则抛出错误

        (async function () {
            try {
                console.log(await new Promise((res, rej) => {
                    setTimeout(() => {
                        res('报名成功');
                    }, 1000);
                }));
                console.log(await new Promise((res, rej) => {
                    setTimeout(() => {
                        res('学习成功');
                    }, 1000);
                }));
                console.log(await new Promise((res, rej) => {
                    setTimeout(() => {
                        rej('简历有问题');
                    }, 1000);
                }));
                console.log(await new Promise((res, rej) => {
                    setTimeout(() => {
                        res('面试成功');
                    }, 1000);
                }));
                console.log(await new Promise((res, rej) => {
                    setTimeout(() => {
                        res('就业成功');
                    }, 1000);
                }));
            }catch(err){
                console.log(err);
            }
        })()


    </script>
</body>

</html>